/*
package com.fm.magic.weapon.legendary;

import com.fm.base.database.*;
import com.fm.base.log.Loggers;
import com.fm.base.logic.Operator;
import com.fm.base.param.HttpProxy;
import com.fm.base.param.MQ;
import com.fm.commons.net.amqp.MsgConsumer;
import com.fm.commons.net.amqp.MsgProducer;
import com.fm.commons.net.http.BasicHttpClient;
import com.fm.commons.net.http.BasicHttpResponse;
import com.fm.commons.net.proxy.DBHttpProxy;
import com.fm.commons.util.QueueConsumers;
import com.fm.commons.util.StringUtil;
import com.fm.mirror.core.Mirror;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.nodes.TextNode;
import org.jsoup.select.Elements;

import java.util.*;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

public class MantaStyle {
	private static final String queueName = "ProxyPool";
	private static final Map<String, String> subjectURL = new HashMap<>();
	private static final Map<String, String> subjectMD5 = new HashMap<>();

	private static MsgProducer<DBSortedDocument> producer = null;
	private static DBClient pool;
	private static DBDomain<DBSortedDocument> domain;

	private static void initDB() {
		pool = Mirror.getInstance("LOCALHOST_MG_PROXIES");
		domain = pool.getDomain("proxies", DBSortedDocument.class);
	}

	public static void end() {
		pool.close();
	}

	// 检查数据库
	private static void checkProxies() {
		producer = new MsgProducer<>(MQ.LOCAL_RABBIT, queueName);
		producer.clear();
		DBResult<DBSortedDocument> iterator = domain.find(null);
		iterator.forEach(producer::send);
		iterator.close();
		producer.close();
		new MsgConsumer<>(queueName, 48, () -> MantaStyle::checkProxy).start();
	}

	public MirrorImage active(String url) {
		return new MirrorImage(url);
	}

	public static class MirrorImage {
		private String target;
		private Boolean accurate;
		private HttpProxy source;
		private HttpProxy.Type model;
		private String part;
		private Integer num;
		private Integer limit;

		private MirrorImage(String url) {
			target = url;
			accurate = true;
			source = null;
			model = null;
			part = null;
			num = 20;
			limit = -1;
		}

		public MirrorImage accurate(boolean accurate) {
			this.accurate = accurate;
			return this;
		}

		public MirrorImage source(HttpProxy proxy) {
			source = proxy;
			return this;
		}

		public MirrorImage model(HttpProxy.Type type) {
			model = type;
			return this;
		}

		public MirrorImage part(String cssSelector) {
			this.part = cssSelector;
			return this;
		}

		public MirrorImage number(int thread) {
			num = thread;
			return this;
		}

		public MirrorImage limit(int limit) {
			this.limit = limit;
			return this;
		}
	}
}
*/
